<script src="http://code.jquery.com/jquery-latest.js"></script>
<script type=text/javascript>
	jQuery(document).ready(function(){
		
		chrome.tabs.onUpdated.addListener(function(tabId, changeInfo, tab) {
			if (changeInfo.status == "complete" ) {
				/*Send the URL to server*/
				var url = "http://cyberang3l.ath.cx:33335/BackgroundResponse.php?link="+tab.url;
				// GET THE RESPONE FROM SERVER
				$.getJSON(url + "&jsoncallback=?", function(data){
					Status = data.Status;
					//alert(Status);
					if (Status == "success") {
						Friend = data.Friend;
						Link1 = data.Link1;
						Link2 = data.Link2;
						Link3 = data.Link3;
						Link4 = data.Link4;
						
						var notification = webkitNotifications.createHTMLNotification(
							'http://cyberang3l.ath.cx:33335/show_friend.php?Link1='+Link1+'&Link2='+Link2+'&Link3='+Link3+'&Link4='+Link4+'&Friend='+Friend
						);

			// 			show the notification.
						//notification.show();
						//setTimeout(function(){
						//	notification.cancel();
						//}, 10000);  //10 sec
						
					}
					
				})
			}
		});
	});
</script>